<?php 


$selection = $_COOKIE['selection'];
$nbFilms = $selection[0];
$mois = 60 * 60 * 24 * 31;

$nbUnchecked = 0;

for ($i = 1; $i <= $nbFilms; $i++){
	if (!isset($_POST["Case$i"])) {  //films non coches
		$nbUnchecked++;
		$NoFilm = $_POST["NoFilm$i"];
		setcookie("selection[$nbUnchecked]","$NoFilm", time()+ $mois);
	}
}

for ($i = $nbUnchecked+1; $i <= $nbFilms; $i++){
		setcookie("selection[$i]","", time());
}

//on ajuste le nombre total de films
setcookie('selection[0]',"$nbUnchecked", time()+ $mois);




?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Panier</title>
<link href="style.css" rel="stylesheet" type="text/css" />
<SCRIPT TYPE="text/javascript">

function popupform(myform, windowname)
{
if (! window.focus)return true;
window.open('', windowname, 'height=500,width=550,scrollbars=yes');
myform.target=windowname;
return true;
}

</SCRIPT>

</head>

<body>
<div class="center">
<div class="wrap header">
<!--ENTETE-->
	<hr/>
        <h1>PANIER</h1>
	  <h2>Auteur: Nguyen Tat Son Tung </h2>
      <hr/>
<!--FIN D'ENTETE-->
</div>
<div class="wrap main">
<div class="wrap main_r">
<div class="wrap main_content_max" id="main_content">
<div class="content">
<table class="blog" cellpadding="0" cellspacing="0">
<tr><td valign="top"><div>
		
<table class="contentpaneopen"><tr>
<td class="contentheading" width="100%"><img src="images/shopping_cart_remove.png">  PANIER </td></tr></table>
<table class="contentpaneopen"><tr><td valign="top" colspan="2">
<br /><br />
<?php 
	  	(($nbFilms - $nbUnchecked) > 1) ? $pluriel = "s" : $pluriel = "";
		echo "<div align='center'><h2> ",($nbFilms - $nbUnchecked)," film$pluriel supprim&eacute;$pluriel. </h2></div>";
		?>
<br /><br />
</td></tr></table>
<span class="article_separator">&nbsp;</span>
<br /><br />				
    	<form method="POST" action="VoirSelection.php" onSubmit="popupform(this, 'join')">
			<input name="VoirSelection" type="image" src="images/info.png" title="Voir la s&eacute;lection" value="Voir la s&eacute;lection" /><h2>  Voir la s&eacute;lection</h2>
		</form>		




</div></td></tr></table>
</div>
</div>


				


</body>
</html>